package com.seadragon.app.ksr.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "EVENT", schema = "STAGING")
public class Event {
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EVENTIDSEQ")
	@SequenceGenerator(name = "EVENTIDSEQ", sequenceName = "STAGING.EVENT_ID_SEQ", schema = "STAGING")
	private long id;
	
	@Column(name="EVENT_NAME")
	private String eventName;
	
	@ManyToMany(cascade = {CascadeType.MERGE}, fetch=FetchType.EAGER)
	@JoinTable(schema = "STAGING", name = "EVENT_CATEGORY", joinColumns = { @JoinColumn(table = "EVENT", name = "EVENT_ID", referencedColumnName = "ID") }, inverseJoinColumns = { @JoinColumn(table = "CATEGORY", name = "CATEGORY_ID", referencedColumnName = "ID") })
	private Set<Category> categories;
	
	/**
	 * It could be camp, concert, competition, etc.
	 */
	@Column(name="EVENT_TYPE")
	private String eventType;
	
	@Column(name="DESCRIPTION")
	private String description;
	
	@Column(name="AGE_FROM")
	private int ageFrom;
	
	@Column(name="AGE_TO")
	private int ageTo;
	
	@Column(name="CONTACT_PERSON")
	private String contactPerson;
	
	@Column(name="PHONE_NUMBER")
	private String phoneNumber;
	
	@Column(name="EMAIL")
	private String email;
	
	@Column(name="NOTES")
	private String notes;
	
	@ManyToOne
	@JoinColumn(name="BUSINESS_ID")
	private Business business;
	
	/**
	 * $, $$, $$$, $$$$
	 */
	@Column(name="PRICE")
	private int price;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getEventName() {
		return eventName;
	}

	public void setEventName(String eventName) {
		this.eventName = eventName;
	}

	public String getEventType() {
		return eventType;
	}

	public void setEventType(String eventType) {
		this.eventType = eventType;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getAgeFrom() {
		return ageFrom;
	}

	public void setAgeFrom(int ageFrom) {
		this.ageFrom = ageFrom;
	}

	public int getAgeTo() {
		return ageTo;
	}

	public void setAgeTo(int ageTo) {
		this.ageTo = ageTo;
	}

	public String getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public Set<Category> getCategories() {
		return categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public Business getBusiness() {
		return business;
	}

	public void setBusiness(Business business) {
		this.business = business;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}
}
